<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include.inc.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="perm/list"
		method="post">
	<input type="hidden" name="pageNum" value="${page.pageNo }" />
	<input type="hidden" name="numPerPage" value="${page.pageSize }" />
	<input type="hidden" name="orderField" value="" />
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>URL：</td>
					<td><input type="text" name="url" value="${page.condition.url }" /></td>
					<td>名称：</td>
					<td><input type="text" name="name" value="${page.condition.name }" /></td>
					<td>创建日期：</td>
					<td><input class="date" name="createDateStartStr" value="<fmt:formatDate value='${page.condition.createDateStart }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true" /> - <input
						class="date" name="createDateEndStr" dateFmt="yyyy-MM-dd HH:mm:ss" value="<fmt:formatDate value='${page.condition.createDateEnd }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						readonly="true" />
					</td>
					
				</tr>
				<tr>
					<td>URL级别：</td>
					<td><input type="text" name="level" value="${page.condition.level }" /></td>
					<td>
						是否启用
					</td>
					<td>
						<select name="isActived">
							<option value="">全部</option>
							<option value="1" <c:if test="${page.condition.isActived==1 }">selected</c:if>>启用</option>
							<option value="0" <c:if test="${page.condition.isActived==0 }">selected</c:if>>禁用</option>
						</select>
					</td>
					<td>关联角色：</td>
					<td>
						<select name="roles">
							<option value="">未选择</option>
							<c:forEach var="role" items="${roleList}">
								<option value="${role.roleName}" <c:if test="${role.roleName ==page.condition.roles }">selected</c:if>>${role.description}</option>
							</c:forEach>
						</select>
					</td>
				</tr>
			</table>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">检索</button>
							</div>
						</div>
					</li>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button onclick="formReSet(this)" type="button">重置</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="perm/add" target="dialog" title="添加权限" rel="majorAddDialog" width=300 height=350><span>添加</span></a></li>
			<li><a class="delete" href="" target="ajaxTodo"
				title="确定要删除吗?"><span>删除</span></a></li>
			<li class="line">line</li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="180">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="majorIds" class="checkboxCtrl" title="全选"></th>
				<th width="40">序号</th>
				<th width="40">URL</th>
				<th width="40">操作名称</th>
				<th width="40">关联角色</th>
				<th width="40">菜单级别</th>
				<th width="40">启用状态</th>
				<th width="40">创建时间</th>
				<th width="40">操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				int i = 0;
			%>
			<c:forEach var="urlFilter" items="${page.list}">
				<tr>
					<td>
						<input type="checkbox" id="majorIds" name="majorIds" value="${major.majorId }" />
					</td>
					<td><%=++i%></td>
					<td>${urlFilter.url }</td>
					<td>${urlFilter.name }</td>
					<td>${urlFilter.roles }</td>
					<td>${urlFilter.level }</td>
					<td><c:if test="${urlFilter.isActived==1 }">已启用</c:if><c:if test="${urlFilter.isActived==0 }">已禁用</c:if></td>
					<td>${urlFilter.createDate }</td>
					<td>
						<a class="btnDel" href="perm/delete?id=${urlFilter.id }" target="ajaxTodo" title="确定要删除权限【${urlFilter.name }】吗？">删除</a>
					 	<a class="btnEdit" href="perm/update?id=${urlFilter.id } " title="编辑权限" rel="editPerm" target="dialog">编辑</a>
					 	<c:if test="${urlFilter.isActived==1 }">
					 		<a class="btnDisable" href="perm/useOrNot?oper=0&id=${urlFilter.id } " target="ajaxTodo" title="确定要禁用用户【${urlFilter.name }】吗？">禁用</a>
					 	</c:if>
					 	<c:if test="${urlFilter.isActived==0 }">
					 		<a class="btnActive" href="perm/useOrNot?oper=1&id=${urlFilter.id } " target="ajaxTodo" title="确定要启用用户【${urlFilter.name }】吗？">启用</a>
					 	</c:if>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="10" <c:if test="${page.pageSize==10 }">selected</c:if>>10</option>
				<option value="20" <c:if test="${page.pageSize==20 }">selected</c:if>>20</option>
				<option value="50" <c:if test="${page.pageSize==50 }">selected</c:if>>50</option>
				<option value="100" <c:if test="${page.pageSize==100 }">selected</c:if>>100</option>
				<option value="200" <c:if test="${page.pageSize==200 }">selected</c:if>>200</option>
			</select>
			<span>条，共${page.totalCount}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="${page.totalCount }" numPerPage="${page.pageSize}" pageNumShown="5" currentPage="${page.pageNo}"></div>

	</div>
</div>